<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>tdbc::mapSqlState manual page - Tcl Database Connectivity</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">TDBC Package Commands, version 1.1.2</a> <small>&gt;</small> tdbc_mapSqlState</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<H3><A NAME="M2">NAME</A></H3>
tdbc::mapSqlState &mdash; Map SQLSTATE to error class
<H3><A NAME="M3">SYNOPSIS</A></H3>
package require <B>tdbc 1.0</B><BR>
<BR>
<B>tdbc::mapSqlState</B> <I>sqlstate</I><BR>
<H3><A NAME="M4">DESCRIPTION</A></H3>
The <B>tdbc::mapSqlState</B> command accepts a string that is expected
to be a five-character 'SQL state' as returned from a SQL database when
an error occurs. It examines the first two characters of the string,
and returns an error class as a human- and machine-readable name (for example,
<B>FEATURE_NOT_SUPPORTED</B>, <B>DATA_EXCEPTION</B> or 
<B>INVALID_CURSOR_STATE</B>).
<P>
The TDBC specification requires database drivers to return a description
of an error in the error code when an error occurs. The description is
a string that has at least four elements: &quot;<B><A HREF="../TdbcCmd/tdbc.htm">TDBC</A></B> <I>errorClass</I>
<I>sqlstate</I> <I>driverName</I> <I>details...</I>&quot;. The <B>tdbc::mapSqlState</B>
command gives a convenient way for a TDBC driver to generate the
<I>errorClass</I> element given the SQL state returned from a database. 
<H3><A NAME="M5">SEE ALSO</A></H3>
<B><A HREF="../TdbcCmd/tdbc.htm">tdbc</A></B>, <B><A HREF="../TdbcCmd/tdbc_tokenize.htm">tdbc::tokenize</A></B>, <B><A HREF="../TdbcCmd/tdbc_connection.htm">tdbc::connection</A></B>, <B><A HREF="../TdbcCmd/tdbc_statement.htm">tdbc::statement</A></B>, <B><A HREF="../TdbcCmd/tdbc_resultset.htm">tdbc::resultset</A></B>
<H3><A NAME="M6">KEYWORDS</A></H3>
<A href="../Keywords/T.htm#TDBC">TDBC</A>, <A href="../Keywords/S.htm#SQL">SQL</A>, <A href="../Keywords/D.htm#database">database</A>, <A href="../Keywords/S.htm#state">state</A>
<H3><A NAME="M7">COPYRIGHT</A></H3>
Copyright (c) 2009 by Kevin B. Kenny.
<div class="copy">Copyright &copy; 2009 by Kevin B. Kenny.
</div>
</BODY></HTML>
